package com.onpositive.gamemaker.android;

import java.io.IOException;
import java.util.WeakHashMap;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class AndroidImageManager {

	static WeakHashMap<String, Bitmap>maps=new WeakHashMap<String, Bitmap>();
	static Context context;
	
	public static Bitmap get(String id){
		Bitmap bitmap = maps.get(id);
		if (bitmap==null){
			try {
				bitmap=BitmapFactory.decodeStream(context.getAssets().open(id));
				maps.put(id, bitmap);
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return bitmap;		
	}
}
